﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>手机解绑</title>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
    <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
      <script src="../js/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="../../Scripts/commen_js/jquery.cookie.min.js"></script>
    <script src="../../Scripts/commen_js/json2.js"></script>
    <script src="../js/MJ_JSComment_two.js"></script>
    <script type="text/javascript">
        
        $(document).ready(function () {
            var code = GetQueryString("code");
            poststr = "{\"type\":\"getopenid\",\"code\":\"" + code + "\"}";
            mj_js_ajax("json", poststr, getopenid);
            $("#submit").click(function () {
                poststr = "{\"type\":\"outbind\",\"code\":\"" + $.cookie("openid") + "\"}";
                mj_js_ajax("json", poststr, show_state);

            })
        })
        function getopenid(data) {
            if (data.result == "ok") {
                $.cookie("openid", data.msg);
                get_data(data.msg);
            }
        }
        function get_data(openid) {
            poststr = "{\"type\":\"getoutbind\",\"code\":\"" + openid + "\"}";
            mj_js_ajax("json", poststr, showdata);

        }
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }
        function showdata(data) {
            if (data.result == "ok") {
                var table_data = data.table;
                if (table_data.length!=0) {
                $("#area").val($.trim(table_data[0].area));
                $("#building").val($.trim(table_data[0].building));
                $("#dorm").val($.trim(table_data[0].drom));
                $("#phone").val($.trim(table_data[0].number));}
                else {
                    $("#tip").show();
                }

            }


        }
     
        function show_state(data) {
            if (data.result == "ok") {
                alert(data.msg);
                $("#area").val("");
                $("#building").val("");
                $("#dorm").val("");
                $("#phone").val("");
                $("#tip").css("display", "block")
            }

        }
    </script>
</head>
<body>
    <div class="container-fluid">
        <h3 class="text-center text-info">
            邑大水行<br />
            用户微信解绑
        </h3>
        <hr />
        <div id="tip" style="margin-top:-13px;margin-bottom:10px;text-align:center;color:red;display:none">没有绑定微信号</div>
        <form class="form-horizontal">
            <div class="form-group">
                <label for="area" style="padding:6px 0px 0px 10px" class="col-xs-2 control-label">
                    区域
                </label><div class="col-xs-10">
                     <input type="text"disabled="disabled"  class="form-control" id="area" />
                </div>
            </div>
            <div class="form-group">
                <label for="building" style="padding:6px 0px 0px 10px" class="col-xs-2 control-label">
                    楼号
                </label><div class="col-xs-10">
                    <input type="text" disabled="disabled" class="form-control" id="building" />
                </div>
            </div>
            <div class="form-group">
                <label for="dorm" style="padding:6px 0px 0px 10px" class="col-xs-2 control-label" style="padding-right: 0;">
                    宿舍号
                </label><div class="col-xs-10">
                    <input type="text"disabled="disabled"  class="form-control" id="dorm" />
                </div>
            </div>
            <div class="form-group">
                <label for="phone" style="padding:6px 0px 0px 10px" class="col-xs-2 control-label">
                    电话
                </label><div class="col-xs-10">
                    <input type="text"disabled="disabled"  class="form-control" id="phone" />
                </div>
            </div>
            <hr />
            <input  value=" 确认解绑" type="button" id="submit" class="btn btn-info btn-block btn-lg"/>
               
            
        </form>
        <div id="tips" class="text-center text-danger">
        </div>
    </div>
</body>
</html>
